/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.aaron.platform.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.FetchType;
import javax.persistence.SequenceGenerator;

/**
 * 组织类
 * @author chenzhuohua
 */
@Entity
@Table(name = "itsc_domain_info")
@SequenceGenerator(name="itsc_domain_generator", sequenceName="itsc_domain_generator", allocationSize = 1)
public class ItscDomainInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    public final static String PROPERTY_DOMAIN_NAME = "domainName";

    public final static String PROPERTY_PARENT_ORG = "parentDomain";
    
    public final static String PROPERTY_DOMAIN_ID = "domainID";
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="itsc_domain_generator")
    @Column(name = "domain_id")
    private Integer domainId;

    @Column(name = "domain_name")
    private String domainName;

    @Column(name = "domain_type")
    private int domainType;

    @Column(name = "domain_desc")
    private String domainDesc;

    @ManyToOne
    @JoinColumn(name = "parent_domain", referencedColumnName = "domain_id")
    private ItscDomainInfo parentDomain;

    @OneToMany(mappedBy = "parentDomain",  cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<ItscDomainInfo> childDomains;

    public ItscDomainInfo() {
    }

    public List<ItscDomainInfo> getChildDomains() {
        return childDomains;
    }

    public void setChildDomains(List<ItscDomainInfo> childDomains) {
        this.childDomains = childDomains;
    }

    public String getDomainDesc() {
        return domainDesc;
    }

    public void setDomainDesc(String domainDesc) {
        this.domainDesc = domainDesc;
    }

    public Integer getDomainId() {
        return domainId;
    }

    public void setDomainId(Integer domainId) {
        this.domainId = domainId;
    }

    public String getDomainName() {
        return domainName;
    }

    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }

    public int getDomainType() {
        return domainType;
    }

    public void setDomainType(int domainType) {
        this.domainType = domainType;
    }

    public ItscDomainInfo getParentDomain() {
        return parentDomain;
    }

    public void setParentDomain(ItscDomainInfo parentDomain) {
        this.parentDomain = parentDomain;
    }
}
